<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace='SysDictionary' xmlns='http://ibatis.apache.org/mapping' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
  <alias>
    <typeAlias alias='SysDictionary' assembly='Janus.Mes.POCO.dll' type='Janus.Mes.POCO.SysDictionary' />
  </alias>
  <resultMaps>
    <resultMap id='SysDictionaryResult' class='SysDictionary'>
	<result property='GroupName' column='GroupName ' /> 
	<result property='DecKey' column='DecKey ' /> 
	<result property='DecValue' column='DecValue ' /> 
	<result property='DecOrder' column='DecOrder ' /> 
	<result property='GKey' column='GKey ' /> 
	<result property='IsSys' column='IsSys ' /> 
	<result property='OperDept' column='OperDept ' /> 
		</resultMap>
  </resultMaps>  
  <statements>
  <sql id="UpdaterConditions">  
  <dynamic prepend="SET">
        	<isPropertyAvailable prepend="" property="DecValue">
        <isNotEmpty prepend="," property="DecValue">
		          [DecValue]=#DecValue#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="DecOrder">
        <isNotEmpty prepend="," property="DecOrder">
		          [DecOrder]=#DecOrder#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="GKey">
        <isNotEmpty prepend="," property="GKey">
		          [GKey]=#GKey#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="IsSys">
        <isNotEmpty prepend="," property="IsSys">
		          [IsSys]=#IsSys#
		          </isNotEmpty>
      </isPropertyAvailable>	
	    	<isPropertyAvailable prepend="" property="OperDept">
        <isNotEmpty prepend="," property="OperDept">
		          [OperDept]=#OperDept#
		          </isNotEmpty>
      </isPropertyAvailable>	
	  	 </dynamic>
    </sql>
	<sql id="WhereConditions">
	 <dynamic prepend="WHERE">
	 	 <isPropertyAvailable prepend="" property="GroupName">
        <isNotEmpty prepend="AND" property="GroupName">
		          [GroupName]=#GroupName#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="DecKey">
        <isNotEmpty prepend="AND" property="DecKey">
		          [DecKey]=#DecKey#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="DecValue">
        <isNotEmpty prepend="AND" property="DecValue">
		          [DecValue]=#DecValue#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="DecOrder">
        <isNotEmpty prepend="AND" property="DecOrder">
		          [DecOrder]=#DecOrder#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="GKey">
        <isNotEmpty prepend="AND" property="GKey">
		          [GKey]=#GKey#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="IsSys">
        <isNotEmpty prepend="AND" property="IsSys">
		          [IsSys]=#IsSys#
		          </isNotEmpty>
      </isPropertyAvailable>
	  	 <isPropertyAvailable prepend="" property="OperDept">
        <isNotEmpty prepend="AND" property="OperDept">
		          [OperDept]=#OperDept#
		          </isNotEmpty>
      </isPropertyAvailable>
	  </dynamic> 
    </sql>
	<sql id="InsertPublic">
      INSERT INTO SysDictionary(
	     <dynamic prepend=" ">
       	   <isPropertyAvailable prepend="" property="GroupName">
        <isNotEmpty prepend="," property="GroupName">
          [GroupName]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="DecKey">
        <isNotEmpty prepend="," property="DecKey">
          [DecKey]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="DecValue">
        <isNotEmpty prepend="," property="DecValue">
          [DecValue]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="DecOrder">
        <isNotEmpty prepend="," property="DecOrder">
          [DecOrder]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="GKey">
        <isNotEmpty prepend="," property="GKey">
          [GKey]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="IsSys">
        <isNotEmpty prepend="," property="IsSys">
          [IsSys]
        </isNotEmpty>
      </isPropertyAvailable>
	  	   <isPropertyAvailable prepend="" property="OperDept">
        <isNotEmpty prepend="," property="OperDept">
          [OperDept]
        </isNotEmpty>
      </isPropertyAvailable>
	  </dynamic>
      )
      VALUES
      (
	   <dynamic prepend=" ">
      	<isPropertyAvailable prepend="" property="GroupName">
        <isNotEmpty prepend="," property="GroupName">		
         #GroupName#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="DecKey">
        <isNotEmpty prepend="," property="DecKey">		
         #DecKey#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="DecValue">
        <isNotEmpty prepend="," property="DecValue">		
         #DecValue#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="DecOrder">
        <isNotEmpty prepend="," property="DecOrder">		
         #DecOrder#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="GKey">
        <isNotEmpty prepend="," property="GKey">		
         #GKey#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="IsSys">
        <isNotEmpty prepend="," property="IsSys">		
         #IsSys#		
        </isNotEmpty>
      </isPropertyAvailable>
	  	<isPropertyAvailable prepend="" property="OperDept">
        <isNotEmpty prepend="," property="OperDept">		
         #OperDept#		
        </isNotEmpty>
      </isPropertyAvailable>
	  </dynamic>
      )
    </sql>
	<!-- Insert statement:新增Mapper-->
    <insert id='Insert' parameterClass='SysDictionary'>
      <include refid="InsertPublic"/>
    </insert>
    <!--Update statement:修改Mapper-->
    <update id='Update' parameterClass='SysDictionary'>
      UPDATE [SysDictionary] 
      <include refid="UpdaterConditions"/>
      WHERE 1=1
	  	  AND GroupName=#GroupName#
	  	  AND DecKey=#DecKey#
	      </update>
    <update id='UpdateSetion' parameterClass='hashtable'>
      UPDATE [SysDictionary] 
      <include refid="UpdaterConditions"/>
      WHERE $conditions$
    </update>
	<update id='Save' parameterClass='SysDictionary'>
      IF NOT EXISTS(SELECT 1 FROM [SysDictionary] WHERE 1=1  AND [GroupName]=#GroupName#  AND [DecKey]=#DecKey# )
      BEGIN
      <include refid="InsertPublic"/>
      END
      ELSE
      BEGIN
      UPDATE SysDictionary 
      <include refid="UpdaterConditions"/>
      WHERE  1=1
	  	  AND [GroupName]=#GroupName#
	  	  AND [DecKey]=#DecKey#
	        END
    </update>
	<delete id='Delete' parameterClass='hashtable'>
      DELETE FROM [SysDictionary] WHERE	  
        <![CDATA[  
	 [GroupName]=#pk0#  AND [DecKey]=#pk1# 
        ]]>
    </delete>
    <delete id='DeleteWhere' parameterClass='string'>
      DELETE FROM [SysDictionary] WHERE $value$
    </delete>

    <!-- select by key statement:-->
    <select id='FindOne' parameterClass='hashtable' resultClass='SysDictionary'>
      SELECT * FROM SysDictionary WHERE      
        <![CDATA[
		[GroupName]=#pk0#  AND [DecKey]=#pk1# 
        ]]>
    </select>
    <select id='FindAllCondition' parameterClass='string' resultClass='SysDictionary'>
      SELECT * FROM [SysDictionary] WHERE $value$
    </select>
    <select id='FindScalar' parameterClass='hashtable' resultClass='SysDictionary'>
      SELECT * FROM [SysDictionary] WHERE $conditions$
    </select>
    
    <select id='FindAllCount' parameterClass='string' resultClass='int'>
      SELECT COUNT(1) FROM [SysDictionary] WHERE $value$
    </select>
    <select id='FindByPage' parameterClass='string' resultClass='SysDictionary'>
      SELECT * FROM [SysDictionary] WHERE $value$
    </select>
  </statements>
</sqlMap>
